package cn.yqx.bankshop.order.service.impl;

import cn.yqx.bankshop.order.dao.BuSupplierStoreMapper;
import cn.yqx.bankshop.order.page.PageRequest;
import cn.yqx.bankshop.order.page.PageResult;
import cn.yqx.bankshop.order.page.PageUtils;
import cn.yqx.bankshop.order.pojo.BuMyTrack;
import cn.yqx.bankshop.order.pojo.BuSupplierStore;
import cn.yqx.bankshop.order.service.SupplierStoreService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SupplierStoreServiceImpl implements SupplierStoreService {
    @Autowired
    BuSupplierStoreMapper mapper ;
    @Override
    public PageResult getAllSupplierStore(PageRequest pageRequest, Map<String, Object> map) {
        return PageUtils.getPageResult(pageRequest, getPageInfoTrack(pageRequest,map)) ;
    }
    private PageInfo<BuSupplierStore> getPageInfoTrack(PageRequest pageRequest, Map<String ,Object> parameterMap){
        int pageNum = pageRequest.getPageNum();
        int pageSize = pageRequest.getPageSize();
        PageHelper.startPage(pageNum, pageSize);
        List<BuSupplierStore> list = mapper.getAllSupplierStore(parameterMap) ;
        return new PageInfo<BuSupplierStore>(list) ;
    }
}
